#include <stdio.h>

#include <UserAPI.h>
#include <Kernel.h>

int File1 (void)
{
    printf("\n I am FILE1 NEED TO BE READ\n");
    return openfile("Aname");
}

int File2 (void)
{
    printf("\n I am FILE2  READ ME NOW\n");
    return openfile("Bname");
}


int func1(void)
{
    printf("\n I am func1 don't interrupt me\n");
    return 0;
}

int func2(void)
{
    printf("\n I am func2 don't interrupt me\n");
    return 0;
}

int func3(void)
{
    printf("\n I am func3 don't interrupt me\n");
    return 0;
}

/************************************Testings**************************************/
#ifdef _Debug_of_Schelduller
void Test_openfile(void);
int main()
{
    /*Test_openfile();*/


    var_t*   data1;
    var_t*   data2;
    var_t*   data3;
    var_t*   data4;
    var_t*   data5;
    Kernel_boot();


    Kernel_initdata(&data1);
    Kernel_initdata(&data2);
    Kernel_initdata(&data3);
    Kernel_initdata(&data4);
    Kernel_initdata(&data5);

    Kernel_SchelduleEvery(File1,700,data4);
    Kernel_SchelduleEvery(func1,200,data1);/*millisecond scale, according to program delay of 10 second*/
    Kernel_SchelduleEvery(func2,300,data2);
    Kernel_SchelduleEvery(File2,300,data5);
    Kernel_SchelduleEvery(func3,400,data3);
    Kern_RunSchel();
    Kern_Shutdown();
    return 0;
}


void Test_openfile()
{
    var_t*   data4;
    Kernel_boot();
    Kernel_initdata(&data4);
    Kernel_SchelduleEvery(File1,1000,data4);
    Kern_RunSchel();
}
#endif /*_Debug_of_Schelduller*/
